package com.linkhub.oms.admin.modules.wms.domain.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.linkhub.oms.common.util.QtOptionalUtil;
import com.linkhub.oms.data.sync.api.wms.domain.response.WmsBaseResponse;
import com.linkhub.oms.admin.modules.order.domain.vo.EmployeeOrderPushToWmsResultVO;
import com.linkhub.oms.common.util.QtOptionalUtil;
import com.linkhub.oms.data.sync.api.wms.domain.response.StockOutBatchCreateResponse;
import com.linkhub.oms.data.sync.api.wms.domain.response.WmsBaseResponse;
import com.linkhub.oms.entity.OrderEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * @Description: WMSConfirmResponse
 * @Author: Jaycle
 * @Date: 2024/5/5 21:15
 * @Version: 1.0
 */
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class WMSConfirmResponse extends WmsBaseResponse implements Serializable {

    /**
     * response
     */
    @JSONField(name = "response")
    private Response response = new Response();
    ;

    @Override
    protected String getFlag() {
        return QtOptionalUtil.of(response)
                .map(Response::getFlag)
                .orElse(null);
    }

    /**
     * Response
     */
    @Data
    @NoArgsConstructor
    public static class Response {
        /**
         * flag
         */
        @JSONField(name = "flag")
        private String flag = "success";
        /**
         * code
         */
        @JSONField(name = "code")
        private String code = "201";
        /**
         * message
         */
        @JSONField(name = "message")
        private String message;
    }

    public static WMSConfirmResponse createSuccessResult() {
        return new WMSConfirmResponse();
    }

    public static WMSConfirmResponse createFailureResult() {
        WMSConfirmResponse wmsConfirmResponse = new WMSConfirmResponse();
        Response response = wmsConfirmResponse.getResponse();
        response.setCode("0");
        response.setFlag("Failed");
        return wmsConfirmResponse;
    }

}
